#ifdef	ADI_OLD

#ifndef	_INPUT_SEQUENCES_H_
#define _INPUT_SEQUENCES_H_

#include <fstream>
#include <iostream>
#include <vector>
#include "InputSequence.h"


#define FIRST_SEQ					1
#define DONE_READING		4
#define notFirstSeq(flags)	(flags &= 0xFE)
#define isFirstSeq(flags)		(flags & 1)

using namespace std;

/* Reads a given stream Buffer after Buffer, and creates the relevant input sequences from it. */
class InputSequences
{
  private:
  	/* FLAGS:
	firstSeq - indicator wether addOneSequence was called before
    is done reading the file?
  	is sorted?
  	*/
  	char flags;
<<<<<<< .mine
  
	vector<InputSequence*> sequences;
	static const int BUFFER_SIZE = 4096;
	//static const int BUFFER_SIZE = 26;
=======

	const uint pageSize;

	static const int BUFFER_SIZE = 4096;
	//static const int BUFFER_SIZE = 26;
>>>>>>> .r29
	
	/* when reading the sequences in a file one by one, 
		we need the following fields to save intermediate state */
	char *filename;
	streamsize bytesRead;
	char buffer[BUFFER_SIZE];
	int buffPos;
	string nextName;
	
	vector<InputSequence*> sequences;

  public:
//	InputSequences();
	InputSequences(const char *filename, uint pageSize);

	~InputSequences();
	
///	uint addOneSequence(ifstream &inputFile);
	
//	void addSequences();

	// Parses the file into many InputSequence. It also initiates appropriate Jobs for the InputSequence.
	void parseFile();

	uint getSequencesNum() const;
	
	inline InputSequence &getSequence(int index);
	
	bool trySort();
	
	inline const char *getFilename();

	inline bool doneReading();
	
	inline bool sorted() const;

	inline void printMatches() const;

#ifdef DEBUG
	void print() const;
#endif

};

inline InputSequence& InputSequences::getSequence(int index)
{
	return *(sequences[index]);
}

inline const char *InputSequences::getFilename()
{
	return filename;
}

inline bool InputSequences::doneReading()
{
	return (flags & DONE_READING);
}

inline bool InputSequences::sorted() const
{
	return (flags & SORTED);
}

inline void InputSequences::printMatches() const
{
	for (vector<InputSequence*>::const_iterator it=sequences.begin() ; it < sequences.end(); it++)
	{
		cout << (*it)->getName() << endl;
		for (vector<Match*>::const_iterator mit = (*it)->sortedMatches.begin(); mit < (*it)->sortedMatches.end(); mit++)
			(*mit)->print();
	}
}

#endif /* _INPUT_SEQUENCES_H_ */

#endif	/* ADI_OLD */
